<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 呈现数据 -->
</body>
<script>
    fetch("http://localhost:8081/getlist").then(res=>{
        return res.json();
    }).then(res=>{
        // console.log(res);
        var userlist = res;
        var users = document.getElementById("users");
        for(var i = 0;i<userList.length;i++){
            var liNode = document.getElementById("li");
            liNode.innerHTML = "<span>" + userList[i]["username"] + "</span>"+
                               "&nbsp&nbsp<span>" + userList[i]["age"] + "</span>" +
                               "&nbsp&nbsp<span>" + userList[i]["choose"] + "</span>" +
                               "&nbsp&nbsp; <a href='/del?deluser='"+userList[i]["userName"]+"'>删除</a>"
        }
        users.appendChild(liNode);
    })
</script>
</html>